package com.yunqiao.api.controller;

import java.util.Map;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import springfox.documentation.annotations.ApiIgnore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yunqiao.api.annotation.Login;
import com.yunqiao.common.exception.CustomApiException;
import com.yunqiao.common.validator.ValidatorUtils;
import com.yunqiao.common.utils.ApiResponse;
import com.yunqiao.service.api.entity.ProtocolEntity;
import com.yunqiao.service.api.ProtocolService;
import com.yunqiao.common.utils.PageUtils;
import com.yunqiao.common.utils.R;


/**
 * 协议
 * @author Crocutax
 * @email wangxw725@163.com
 * @date 2019-03-03 21:58:56
 */
@RestController
@RequestMapping("api/protocol")
@Api(tags = "ProtocolApiController" ,description = "协议管理")
public class ProtocolApiController {

    @Autowired
    private ProtocolService protocolService;


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    @ApiOperation("查询单个协议")
    @ApiImplicitParam(name = "id", value = "1用户协议-2关于我们-3:服务指南", required = true,defaultValue = "1",paramType = "path" , dataType = "int")
    public ApiResponse<ProtocolEntity> info(@PathVariable("id") Long id){
        if (id == null) {
            throw new CustomApiException("ID不能为空");
        }
        ProtocolEntity protocol = protocolService.getById(id);
        return new ApiResponse<>(protocol);
    }
}
